import java.io.*;
import java.util.*;

public class ProfileLoader  {

    private static Hashtable proHashTable = new Hashtable();
    private static Vector proVector = new Vector();
    private String fileName;

    public static void main( String args[] )
    {
	ProfileLoader loader = new ProfileLoader();
	loader.setFileName("./_profile.txt");
	loader.loadProfile();
	System.out.println("====================================");
	loader.printHashtable(loader.getHashtable());
	System.out.println("====================================");
	System.out.println(proVector);
    }

    public void setFileName(String file_name) {
	fileName = file_name;
    }

    public void loadProfile () {
	String temp1 = null;
	String temp2 = null;
	File name = new File(fileName);

	if ( !name.exists() ) {
	    System.out.println("File:"+name.getName()+" not found!");
	    return;
	}

	if ( name.isFile() ) {
	    System.out.println("Loading file: " + name.getName()+"......");
	    try {
		FileReader r =  new FileReader( name);
		BufferedReader br = new BufferedReader (r);
		String text;

		while( ( text = br.readLine() ) != null ) {
		    if (!text.startsWith("#")) {

			StringTokenizer tokens = new StringTokenizer(text,"\t");

			while (tokens.hasMoreTokens()) {
			    temp1 = (String)tokens.nextToken();
			    temp2 = (String)tokens.nextToken();
			    System.out.println(temp1);
			    System.out.println(temp2);
			    proHashTable.put(temp1, temp2);
			    proVector.add(temp1);
			    proVector.add(temp2);
			}
		    }
		}
	   }
	   catch( IOException e ) {

	   }
       }
    }

    public Hashtable getHashtable () {
	return proHashTable;
    }

    public Vector getVector () {
	return proVector;
    }

    public void printHashtable ( Hashtable hashtab) {
	String temp = null;
	Enumeration enum = hashtab.keys();  	   
	while (enum.hasMoreElements()) {
	    temp = (String)enum.nextElement();
	    System.out.println(temp);
	    System.out.println(hashtab.get(temp).toString());
	}
    }
}





